package org.jeecg.modules.chg.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.bl.entity.BlExpenses;
import org.jeecg.modules.bl.entity.BlSubExpenses;
import org.jeecg.modules.chg.entity.ChgArrears;
import org.jeecg.modules.chg.entity.ChgSubArrear;
import org.jeecg.modules.chg.vo.ChgArrearsPage;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 欠费记录
 * @Author: jeecg-boot
 * @Date:   2022-02-13
 * @Version: V1.0
 */
public interface IChgArrearsService extends IService<ChgArrears> {

	/**
	 * 添加一对多
	 *
	 */
	public void saveMain(ChgArrears chgArrears,List<ChgSubArrear> chgSubArrearList,String waterReadCycle) ;

	/**
	 * 修改一对多
	 *
	 */
	public void updateMain(ChgArrears chgArrears,List<ChgSubArrear> chgSubArrearList);

	/**
	 * 删除一对多
	 */
	public void delMain (String id);
	/**
	 * 删除水费明细一对多
	 */
	public void delSubByMainId (String id);

	/**
	 * 删除杂项明细一对多
	 */
	public void delAlienSubByMainId (String id);


    @Transactional
    void delAlienMain(String id);

    /**
	 * 批量删除一对多
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);

	/**
	 * 创建欠费记录及明细
	 * @param isPreinvoiced 是否预开票
	 * @param amountObj 计量信息（起止读、水量、换表数据）
	 * @param expenses 计费
	 * @param blSubExpensesList 计费明细
	 * @return
	 */
	public ChgArrearsPage createArrears(Integer isPreinvoiced, JSONObject amountObj
			, BlExpenses expenses, List<BlSubExpenses> blSubExpensesList);

	//根据缴费账号查询欠费明细记录
	public List<ChgSubArrear> selectByAccCode(@Param("accCode") String accCode);

	/**欠费违约金计费*/
	public void expensesPenalty();

	/**预存账号自动缴费*/
	public void feeAutoPayment();

	/**获取欠费的预存户且余额大于0  */
	public List<ChgArrears>getArrearAutoPayList();

	/**获取欠费记录及账号信息  */
    List<ChgArrears>getArrearList(ChgArrears chgArrears);

    /**根据缴费账号获取欠费账单记录*/
	List<ChgArrears>getArrearBillList(String accCode);

	/**欠费微信催缴*/
    Result<?> wxMsg(ChgArrears queryWrapper);
	/**欠费短信催缴*/
    Result<?> smsMsg(ChgArrears queryWrapper);

    Result<?> smsStopMsg(ChgArrears queryWrapper);

    /**微信支付回调通知-主动查找订单状态*/
	public void feeWeixinPayNotify();
}
